import React, { Component } from 'react'
import Ctx from './store/Ctx'

export default class XiangQing extends Component {

    //获取数据
    static contextType = Ctx



    render() {

        //获取id 
        let { id } = this.props.match.params
        console.log(id);
        /*console.log(this.props); */
        let { list } = this.context
        let newlist = list.find(item => {
            if(item.id==id){
                return item
            }
        })


        return (
            <div>
                <p>{newlist.title}</p>
                <p>{newlist.bz}</p>
            </div>
        )
    }
}
